package com.goldplusgold.network.lib.http;





import com.goldplusgold.network.lib.BuildConfig;

import retrofit2.Retrofit;
import retrofit2.converter.gson.GsonConverterFactory;

/**
 * Created by Administrator on 2017/7/11.
 */

public class BaseRetrofit {
    private Retrofit retrofit;
    private static BaseRetrofit instance;

    private BaseRetrofit() {

        retrofit = new Retrofit.Builder()
                .baseUrl(BuildConfig.GOLD_EXPERT_HOST_URL)
                .addConverterFactory(GsonConverterFactory.create())
                .build();
    }

    public static BaseRetrofit getInstance() {
        if (instance == null) {
            synchronized (BaseRetrofit.class) {
                if (instance == null) {
                    instance = new BaseRetrofit();
                }
            }
        }
        return instance;
    }

    public <T> T create(Class<T> service) {
        return retrofit.create(service);
    }
}
